<template>
  <div>
    <div class="jnhfxq_box">
      <div class="jnhfxq_box_title">
        {{ list.title }}
      </div>
      <div class="jnhfxq_nr_box">
        <!-- <span v-if="list.type == 'user'" style="margin-right: 1rem;">个人会议 </span> -->
        <span v-if="list.type == 'user'"> 会议类型：个人会议</span>
        <span style="margin-right: 1rem; margin-left: 1rem">
          报名截止时间：{{ list.deadline_date }}</span
        >
        会议时间：{{ list.meet_start_date }} - {{ list.meet_end_date }}
      </div>
      <div class="nr_item" v-html="list.content"></div>
      <div class="button_bm">
        <el-button type="primary" @click="handleClick(list.id)"
          >立即报名</el-button
        >
      </div>
    </div>
  </div>
</template>
  <script>
export default {
  data() {
    return {
      id: this.$route.query.id,
      list: {},
    };
  },
  mounted() {
    this.getinfo();
  },
  methods: {
    /**
     * 获取列表
     */
    getinfo() {
      let that = this;
      let id = that.id;
      let data = {
        id: id,
      };
      that.$http.post("meet/detail", data).then((res) => {
        if (res.code === 1) {
          that.list = res.data;
        } else {
          that.list = {};
        }
      });
    },
    /**
     * 立即报名
     */
    handleClick(e) {
      let that = this;

      let list = {};
      that.$http.post("user/check_fee_status", list).then((res) => {
        if (res.data.status == 0 || res.data.status == 2) {
          that.$self
            .ts(res, 2)
            .then(() => {
              if (userinfo.group_id == 1) {
                this.$router.push({
                  path: "/grjnhf",
                });
              }
            })
            .catch(() => {
              if (userinfo.group_id == 1) {
                this.$router.push({
                  path: "/grjnhf",
                });
              }
            });
        } else {
          let data = {
            type: 2,
            id: that.id,
          };
          that.$http.post("meet/check_meet", data).then((res) => {
            let obj = {
              code: res.code,
              msg: "",
            };
            if (res.data.status == 1) {
              obj.msg = "您已经报过名了";
            } else if (res.data.status == 2) {
              obj.msg = "无法报名";
            } else {
              this.$router.push({ path: "/grhybmxq_2", query: { id: e } });
              return;
            }
            that.$self.ts(obj, 2).then(() => {
              this.$router.push({ path: "/grhybm" });
            });
          });
        }
      });
    },

    //  ==
  },
};
</script>
  <style scoped>
.jnhfxq_box {
  background: #ffffff;
  border-radius: 0.125rem;
  box-shadow: 1px 1px 3px 2px rgba(0, 0, 0, 0.15);
  margin: 0.125rem 0.025rem 0.1rem 0.625rem;
  padding-bottom: 0.4875rem;
}
.jnhfxq_box_title {
  height: 1.25rem;
  text-align: center;
  line-height: 1.25rem;
  font-size: 0.25rem;
  font-weight: 400;
  color: #333333;
}
.jnhfxq_nr_box {
  width: 14rem;
  border-top: 0.0375rem dotted #dddd;
  margin: auto;
  font-size: 0.25rem;
  font-weight: 400;
  color: #cd0000;
  line-height: 0.375rem;
  padding-top: 0.325rem;
}
.nr_item {
  text-indent: 2em;
  width: 14rem;
  margin: 0.6125rem auto;
  font-size: 0.225rem;
  font-weight: 400;
  color: #333333;
  line-height: 0.45rem;
}
.button_bm {
  width: 14rem;
  margin: 0.6125rem auto 0;
}
::v-deep .el-button {
  font-size: 0.2rem;
}
</style>